package health.lm.com.mine.present;


import health.lm.com.component_base.base.mvp.contract.XPresent;
import health.lm.com.mine.activity.SettingMobileActivity;
import health.lm.com.mine.model.MineModel;
import health.lm.com.network.callback.SimpleCallBack;
import health.lm.com.network.exception.ApiException;

/**
 * 修改手机号
 */

public class SettingMobilePresenter extends XPresent<SettingMobileActivity> {

    public void submit(String phone, String code) {
        MineModel.getInstance().changeMobile(phone, code, new SimpleCallBack<Object>() {
            @Override
            public void onError(ApiException e) {

            }

            @Override
            public void onSuccess(Object o) {
                if (hasV()){
                    getV().submitSuccess();
                }
            }
        });

    }

    public void getCode(String phone) {
        MineModel.getInstance().sendMsgCode(phone,1, new SimpleCallBack<Object>() {
            @Override
            public void onError(ApiException e) {

            }

            @Override
            public void onSuccess(Object o) {
                if (hasV()){
                    getV().getCodeSuccess();
                }
            }
        });
    }
}
